package matlap.client.view.distributor;

import matlap.client.view.MatlapGWT;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.MenuItemSeparator;

public class DistributorMenuComposite extends Composite {

	private MenuItem mntmRend;
	private MenuItem mntmRendel;
	private MenuItem mntmAdataim;
	private MatlapGWT matlap;
	private Panel bigPanel;
	private String who;

	public DistributorMenuComposite(Panel bP, String w, MatlapGWT matlapGWT) {
		bigPanel = bP;
		who = w;
		matlap = matlapGWT;
		final VerticalPanel horizontalPanel = new VerticalPanel();
		initWidget(horizontalPanel);
		horizontalPanel.setSize("151px", "97px");

		MenuBar menuBar_1 = new MenuBar(true);
		menuBar_1.setStyleName("MenuBar2");
		horizontalPanel.add(menuBar_1);
		menuBar_1.setSize("151px", "97px");

		mntmRend = new MenuItem(" Rendel\u00E9s  ", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new NewOrderComposite(who));
				matlap.setUnSelectedMenuItem();
				mntmRend.setStyleName("SelectedMenuItem2");
				mntmRendel.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				matlap.setUnSelectedMenuItem();
			}
		});

		mntmRend.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmRend);
		mntmRend.setSize("151px", "23px");

		MenuItemSeparator separator = new MenuItemSeparator();
		separator.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator);
		separator.setSize("151px", "2px");

		mntmRendel = new MenuItem(" Rendel\u00E9seim  ", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new MyOrdersComposite(who));
				mntmRend.setStyleName("MenuItem2");
				mntmRendel.setStyleName("SelectedMenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				matlap.setUnSelectedMenuItem();
			}
		});
		mntmRendel.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmRendel);
		mntmRendel.setSize("151px", "23px");

		MenuItemSeparator separator1 = new MenuItemSeparator();
		separator1.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator1);
		separator1.setSize("151px", "2px");

		mntmAdataim = new MenuItem(" Adataim   ", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new DistributorAccountComposite(who));
				mntmRend.setStyleName("MenuItem2");
				mntmRendel.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("SelectedMenuItem2");
				matlap.setUnSelectedMenuItem();
			}
		});
		mntmAdataim.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmAdataim);
		mntmAdataim.setSize("151px", "23px");

	}

	public void setUnSelectedMenuItems() {
		mntmRend.setStyleName("MenuItem2");
		mntmRendel.setStyleName("MenuItem2");
		mntmAdataim.setStyleName("MenuItem2");

	}

}
